<?php /* Smarty version Smarty-3.0.8, created on 2015-10-15 10:48:42
         compiled from "tpl/tools_webback.html" */ ?>
<?php /*%%SmartyHeaderCode:1286316355561f140a660159-70396589%%*/if(!defined('SMARTY_DIR')) exit('no direct access allowed');
$_smarty_tpl->decodeProperties(array (
  'file_dependency' => 
  array (
    '58fed01b0ecfb2bb96790be8a320978ee4e065fe' => 
    array (
      0 => 'tpl/tools_webback.html',
      1 => 1444876874,
      2 => 'file',
    ),
  ),
  'nocache_hash' => '1286316355561f140a660159-70396589',
  'function' => 
  array (
  ),
  'has_nocache_code' => false,
)); /*/%%SmartyHeaderCode%%*/?>
<?php if (!is_callable('smarty_modifier_date_format')) include '/var/www/html/magroup/SpeedPHP/Drivers/Smarty/plugins/modifier.date_format.php';
?><?php $_template = new Smarty_Internal_Template("tpl/header.html", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate(); $_template->rendered_content = null;?><?php unset($_template);?>
<h2 class="ytadmin-h2">网站备份</h2>
<div class="eee_bg">
	<h3>数据库备份</h3>
	<hr />
	<p>数据备份需浏览器支持js，并输入登录密码后操作！</p>
	<p>数据恢复请使用PHPMYADMIN的导入功能，将备份的SQL数据导入。</p>
	<form id="form1" name="form1" method="post" action="">
		登录密码：<input type="password" name="db_password"  value=""/>
		<?php if ($_smarty_tpl->getVariable('chk')->value){?>
			<div>已检查所有表，请对有问题的表点击修复操作进行修复</div>
			<input type="button" value="返回" onclick="window.location.href='<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['spUrl'][0][0]->__template_spUrl(array('c'=>'tools','a'=>'webback'),$_smarty_tpl);?>
'"/>
		<?php }else{ ?>
			<input name="chk" type="submit" value="检查所有表" />
		<?php }?>
		|   
		<a href="javascript:void(0)" id="download" onclick="databseOut('<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['spUrl'][0][0]->__template_spUrl(array('c'=>'tools','a'=>'dbbackup','ouall'=>'yes'),$_smarty_tpl);?>
')">备份全部数据</a>
    </form>
	<h3>使用中</h3>
	<hr />
	<form id="form1" name="form1" method="post" action="">
    <table width="100%" class="table2">
    <tr>
      <th align="center" width="50" valign="middle">数据表</th>
        <th width="30" align="center" valign="middle">引擎</th>
         <th width="70" align="center" valign="middle">字符集</th>
         
        <th width="50" align="center" valign="middle">占用空间</th>
       
        <th width="50" align="center" valign="middle">记录数</th>
        <th width="40" align="center" valign="middle">表状态</th>
        
        <th width="70" align="center" valign="middle">创建时间</th>
         <th width="70" align="center" valign="middle">更新时间</th>
        <th width="70" align="center" valign="middle">检查时间</th>
        
        <th width="100" valign="middle">多余</th>
        <th width="130" align="center"  valign="middle">操作</th>
      </tr>
	  <?php  $_smarty_tpl->tpl_vars['d'] = new Smarty_Variable;
 $_from = $_smarty_tpl->getVariable('table')->value['rs']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array');}
if ($_smarty_tpl->_count($_from) > 0){
    foreach ($_from as $_smarty_tpl->tpl_vars['d']->key => $_smarty_tpl->tpl_vars['d']->value){
?>
		<tr>
		  <td><?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_NAME'];?>
<?php if ($_smarty_tpl->tpl_vars['d']->value['TABLE_COMMENT']!=''){?>(<?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_COMMENT'];?>
)<?php }?></td>
		  <td valign="middle"><?php echo $_smarty_tpl->tpl_vars['d']->value['ENGINE'];?>
</td>
			<td valign="middle"><?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_COLLATION'];?>
</td>
			
			 <td valign="middle"><?php echo formatBytes(array('size'=>$_smarty_tpl->tpl_vars['d']->value['DATA_LENGTH']),$_smarty_tpl);?>
</td>
			 <td valign="middle"><?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_ROWS'];?>
</td>
			<td valign="middle"><?php if ($_smarty_tpl->tpl_vars['d']->value['ROW_FORMAT']=='Dynamic'){?>动态<?php }else{ ?>静态<?php }?></td>
			
			<td valign="middle"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['d']->value['CREATE_TIME'],"%Y-%m-%d");?>
</td>
			<td valign="middle"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['d']->value['UPDATE_TIME'],"%Y-%m-%d");?>
</td>
			<td valign="middle"><?php echo smarty_modifier_date_format($_smarty_tpl->tpl_vars['d']->value['CHECK_TIME'],"%Y-%m-%d");?>
</td>

			<td valign="middle"><?php if ($_smarty_tpl->tpl_vars['d']->value['DATA_FREE']!=0){?><?php echo formatBytes(array('size'=>$_smarty_tpl->tpl_vars['d']->value['DATA_FREE']),$_smarty_tpl);?>
 <?php }else{ ?>正常 <?php }?></td>
			<td align="right" valign="middle">
		  
			<?php if ($_smarty_tpl->tpl_vars['d']->value['DATA_FREE']!=0){?><input type="button" name="button" id="button" value="优化表" onclick="tableOp('<?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_NAME'];?>
')" /> <?php }?>
			<?php if ($_smarty_tpl->tpl_vars['d']->value['CHECK_TABLE']!='OK'&&$_smarty_tpl->tpl_vars['d']->value['CHECK_TABLE']!='NCHECK'){?>
			  <input type="button" name="button" id="button" value="修复表" onclick="tableRep('<?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_NAME'];?>
','<?php echo $_smarty_tpl->tpl_vars['d']->value['CHECK_TABLE'];?>
')"  />
			 <?php }?>
			 
			 <?php if (!isset($_smarty_tpl->tpl_vars['d']) || !is_array($_smarty_tpl->tpl_vars['d']->value)) $_smarty_tpl->createLocalArrayVariable('d');
if ($_smarty_tpl->tpl_vars['d']->value['DATA_FREE'] = 0||$_smarty_tpl->tpl_vars['d']->value['CHECK_TABLE']!='NCHECK'||$_smarty_tpl->tpl_vars['d']->value['CHECK_TABLE']!='OK'){?> 
			  <input type="button" name="button" id="tab_o_<?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_NAME'];?>
" value="导出" onclick="outputTab('<?php echo $_smarty_tpl->tpl_vars['d']->value['TABLE_NAME'];?>
');"  />
			   <?php }?>
			</td>
		  </tr>
	  
	   <?php }} ?>
	   <tr>
		  <td>表总数：<strong><?php echo $_smarty_tpl->getVariable('table')->value['all_table'];?>
</strong></td>
		  <td valign="middle"></td>
			<td align="right" valign="middle">占用空间：</td>
			
			 <td valign="middle"><?php echo formatBytes(array('size'=>$_smarty_tpl->getVariable('table')->value['all_byte']),$_smarty_tpl);?>
</td>
			 <td valign="middle">&nbsp;</td>
			<td valign="middle">&nbsp;</td>
			
			<td valign="middle">&nbsp;</td>
		  <td valign="middle">&nbsp;</td>
			<td align="right" valign="middle">多余:</td>
			<td valign="middle"><?php echo formatBytes(array('size'=>$_smarty_tpl->getVariable('table')->value['all_free']),$_smarty_tpl);?>
</td>
			<td valign="middle"></td>
		</tr>
	</table>
	</form>

	<h3>源码/文件备份</h3>
	<hr />
	<p>windows服务器下不可使用！</p>
	<form id="form" target="_blank" name="form" method="post" action="<?php echo $_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['spUrl'][0][0]->__template_spUrl(array('c'=>'tools','a'=>'filebackup'),$_smarty_tpl);?>
">
		登录密码：<input type="password" name="password"  value=""/>
		<input type="submit" name="backup"  value="备份"/>
	</form>
	
</div>
<script>
$(function(){
});
var urlpath = "/"+"<?php echo $_smarty_tpl->getVariable('url')->value;?>
";
/*优化表*/
function tableOp(tab)
{
	 $.post(urlpath+'/index.php?c=tools&a=dbbackup&dbac=op&tabl='+tab+'&password='+$("input[name='db_password']").val(),function(rs){window.location.reload();})
}

/*修复*/
function tableRep(tab,msg)
{
	alert('表故障原因'+msg);
	 $.post(urlpath+'/index.php?c=tools&a=dbbackup&dbac=rep&tabl='+tab+'&password='+$("input[name='db_password']").val(),function(rs){window.location.reload();})
}

function outputTab(tab)
{
	window.location.href=urlpath+'/index.php?c=tools&a=dbbackup&outab='+tab+'&password='+$("input[name='db_password']").val();
}

function databseOut(url)
{
	$('#download').html('执行中...').attr('disabled',true);
	window.location.href=url+'&password='+$("input[name='db_password']").val();
}

</script>

<?php $_template = new Smarty_Internal_Template("tpl/footer.html", $_smarty_tpl->smarty, $_smarty_tpl, $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, null, null);
 echo $_template->getRenderedTemplate(); $_template->rendered_content = null;?><?php unset($_template);?>